/**
 * 
 */
package cc3002;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * JUnit Test class : HealthState
 * ------------------------------
 * We will test our health-storing class.
 * @author Anibal Llanos Prado
 *
 */
public class HealthStateTest {

	/**
	 * Our fixtures, one for each constructor.
	 */
	private HealthState health1;
	private HealthState health2;
	/**
	 * Setup Method.
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		health1=new HealthState();
		health2=new HealthState(1);
	}

	/**
	 * Test method for {@link cc3002.HealthState#setFoodSaver(int, int)}.
	 */
	@Test
	public void testSetFoodSaver() {
		health1.setFoodSaver(1, 2);
		health2.setFoodSaver(3, 4);
		assertFalse(health2.getFoodSaver().equals(health1.getFoodSaver()));
		assertEquals(health1.getFoodSaver(), "12");
		assertEquals(health2.getFoodSaver(), "34");
	}

	/**
	 * Test method for {@link cc3002.HealthState#setState(int)}.
	 */
	@Test
	public void testSetState() {
		health1.setState(4);
		health2.setState(0);
		assertFalse(health1.getState()==health2.getState());
		assertEquals(health1.getState(),4);
		assertEquals(health2.getState(),0);
	}

	/**
	 * Test method for {@link cc3002.HealthState#getWorst()}.
	 */
	@Test
	public void testGetWorst() {
		assertEquals(health1.getState(),3);
		health1.getWorst();
		assertEquals(health1.getState(),2);
		assertEquals(health2.getState(),1);
		health2.getWorst();
		assertEquals(health2.getState(),0);
		health2.getWorst();
		assertEquals(health2.getState(),0);
	}

	/**
	 * Test method for {@link cc3002.HealthState#getBetter()}.
	 */
	@Test
	public void testGetBetter() {
		assertEquals(health1.getState(),3);
		health1.getBetter();
		assertEquals(health1.getState(),4);
		health1.getBetter(); health1.getBetter(); health1.getBetter();
		assertEquals(health1.getState(),6);
		assertEquals(health2.getState(),1);
		health2.getBetter();
		assertEquals(health2.getState(),2);
	}

	/**
	 * Test method for {@link cc3002.HealthState#toString()}.
	 */
	@Test
	public void testToString() {
		assertEquals(health1.toString(),"Normal");
		assertEquals(health2.toString(),"Really Sick");
		health1.getBetter(); health2.getWorst();
		assertEquals(health1.toString(),"Healthy");
		assertEquals(health2.toString(),"Dying");
		health1.getBetter(); health1.getBetter(); health1.getBetter();
		health2.getWorst();
		assertEquals(health1.toString(),"Inmortal");
		assertEquals(health2.toString(),"Dying");
	}

	/**
	 * Test method for {@link cc3002.HealthState#getFoodMultiplier()}.
	 */
	@Test
	public void testGetFoodMultiplier() {
		assertTrue(health1.getFoodMultiplier()==1);
		assertTrue(health2.getFoodMultiplier()==0.3);
	}

	/**
	 * Test method for {@link cc3002.HealthState#getCCMultiplier()}.
	 */
	@Test
	public void testGetCCMultiplier() {
		assertTrue(health1.getCCMultiplier()==1);
		assertTrue(health2.getCCMultiplier()==1.6);
	}

}
